#include<iostream>
#include<set>
using namespace std;

struct Point{
	int x,y;
	bool operator<(const Point &rhs) const{
		if(x==rhs.x){
			return y<rhs.y;
		}else{
			return x<rhs.x;
		}
	}
};
int main(){
	int n;
	set<Point> v;
	cin >> n;
	for(int i=0;i<n;i++){
		Point temp;
		cin >> temp.x >> temp.y;
		v.insert(temp);
	}
	for(set<Point>::iterator it=v.begin();it!=v.end();it++){
		cout << it->x << " " << it->y << endl;
	}
	return 0;
}
